package com.example.camerapush;

import android.app.Application;

import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.cookie.CookieJarImpl;
import com.zhy.http.okhttp.cookie.store.PersistentCookieStore;

import org.acra.ACRA;
import org.litepal.LitePal;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;

/**
 * Author:lsh
 * Version: 1.0
 * Description:
 * Date: 2018/2/21
 */

public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        ACRA.init(this);
        LitePal.initialize(this);
        CookieJarImpl cookieJar = new CookieJarImpl(new PersistentCookieStore(getApplicationContext()));
        OkHttpClient okHttpClient = new OkHttpClient.Builder()
//                .addInterceptor(new LoggerInterceptor("TAG"))
                .cookieJar(cookieJar)
                .connectTimeout(10000L, TimeUnit.MILLISECONDS)
                .readTimeout(10000L, TimeUnit.MILLISECONDS)
                //其他配置
                .build();
        okHttpClient.dispatcher().setMaxRequests(1);
        OkHttpUtils.initClient(okHttpClient);
    }
}
